package icu.d4peng.basic.knife4j.config;

import icu.d4peng.basic.knife4j.annotations.EnableKnife4j;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;

/**
 * Knife4jConfig
 *
 * @author d4peng <a href="d4peng@qq.com">d4peng@qq.com</a>
 * @since 2023.12.03
 */
@Configuration
@EnableKnife4j
public class Knife4jConfig {

	@Bean
	public OpenAPI customOpenAPI() {
		Contact contact = new Contact();
		contact.setName("d4peng");
		return new OpenAPI().info(new Info().title("XXX用户系统API")
			.contact(contact)
			.version("1.0")
			.description("Knife4j集成springdoc-openapi示例")
			.termsOfService("https://doc.xiaominfo.com")
			.license(new License().name("Apache 2.0")
				.url("https://doc.xiaominfo.com")));/*
													 * .addSecurityItem(new
													 * SecurityRequirement().addList(
													 * HttpHeaders.AUTHORIZATION))
													 * .components(new
													 * Components().addSecuritySchemes(
													 * HttpHeaders.AUTHORIZATION,new
													 * SecurityScheme()
													 * .name(HttpHeaders.AUTHORIZATION).
													 * type(SecurityScheme.Type.HTTP).
													 * scheme("bearer")));
													 */
	}

}
